{% extends 'mobile/base.html' %}
{% load static cmstags murl %}
{% block css %}
    <link rel="stylesheet" href="{% static '/css/category.css' %}"/>
{% endblock %}
{% block seo %}
    {% if category %}
        <title>{{ category.name }} - {{ settings.site_title }}</title>
    {% else %}
        <title>全部分类 - {{ settings.site_title }}</title>
    {% endif %}

    {% if category.keywords and category.description %}
        <meta name="keywords" content="{{ category.keywords }}"/>
        <meta name="description" content="{{ category.description }}"/>
    {% else %}
        <meta name="keywords" content="{{ settings.keywords }}"/>
        <meta name="description" content="{{ settings.description }}"/>
    {% endif %}
{% endblock %}
{% block navbar %}
    <div class="navbar">
        {% get_all_category as categorys %}
        <a {% if alias == 'topic' %} class="active" {% endif %} href="{% get_category_url 'topic' %}">全部</a>
        {% for item in categorys %}
            <a {% if alias == item.alias %} class="active" {% endif %} href="{% get_category_url item.alias %}">{{ item.name }}</a>
        {% endfor %}

    </div>
{% endblock %}

{% block main %}
    {% get_category category.alias current_page 20 as data %}
    <div class="block">
        <div class="head-title">{{ category.name|default:'全部' }}</div>
        {% for item in data.list %}
            <a href="{% get_article_url item.category__alias item.id %}" class="item">
                <div class="cover">
                    <img src="{{ item.cover }}">
                </div>
                <div class="info">
                    <div class="title">{{ item.title }}</div>
                    <div class="summary">{{ item.summary|slice:':20' }}</div>
                    <div class="time">
                            <span class="date">
                                <span class="iconfont icon-date"></span>
                                <span>{{ item.create_date|date:'Y-m-d' }}</span>
                            </span>
                        <span class="hits">
                                <span class="iconfont icon-yanjing"></span>
                                <span>{{ item.hits }}</span>
                            </span>
                    </div>
                </div>
            </a>
        {% endfor %}
        {% get_category_page category.alias as url %}
        {% get_mobile_paginator data.num_pages current_page 5 url %}
    </div>
     {% get_tag_random 40 as tags %}
    <div class="block">
        <div class="head-title">热门标签</div>
        <div class="tags hot-tags">
            {% for tag in tags %}
                <a href="/tag/{{ tag.name }}.html">{{ tag.name }}</a>
            {% endfor %}
        </div>
    </div>
{% endblock %}